package questionnaire.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import questionnaire.controller.vo.QuestionnaireVO;
import questionnaire.service.QuestionnaireService;


/**
 * @author: cjn
 * @date: 2021/1/26 10:23
 */

@RestController
@RequestMapping("/api/questionnaire")
public class QuestionnaireController {

    @Autowired
    private QuestionnaireService questionnaireService;

    @RequestMapping(value = "/getScore", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String getScoreAndConclusion(@RequestBody QuestionnaireVO questionnaireVO){
        String conclusion = questionnaireService.calcFinalScore(questionnaireVO);
        return conclusion;
    }
}
